package cp3120.view;

import cp3120.dao.DAOFactory;
import cp3120.model.pricing.PricingStrategy;
import generic.swing.ListView;
import java.util.List;

/**
 *
 * @author Adam Scarr <scarr.adam@gmail.com>
 */
public class PricingStrategyListView extends ListView<PricingStrategy> {

    public PricingStrategyListView() {
        setTitle("Promotions Manager");
    }

    protected List<PricingStrategy> getList() {
        return DAOFactory.getPurchaseDAO().getPricingStrategys();
    }

    protected void delete(PricingStrategy ps) {
        DAOFactory.getPurchaseDAO().removePricingStrategy(ps);
    }

    protected void edit(PricingStrategy ps) {
        new PricingStrategyEditor(ps).setVisible(true);
    }

    protected void add() {
        new PricingStrategyEditor().setVisible(true);
    }

    protected void ok() {
        dispose();
    }
}
